Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mail notification #823

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Mail notification #823

wants to merge 7 commits into from

Conversation

gsanchietti
Copy link
Member

@gsanchietti gsanchietti commented Mar 6, 2025

TODO:

  • create an Italian default template
  • fallback to local mail address if user does not have a configured one

Install

Install the custom core image:

curl https://raw.githubusercontent.com/NethServer/ns8-core/main/core/install.sh > install.sh 
bash install.sh ghcr.io/nethserver/core:mail_notification
create-cluster rl1.leader.cluster0.gs.nethserver.net:55820 10.5.4.0/24 Nethesis,1234

Setup custom images for Samba and OpenLDAP:

redis-cli hset cluster/override/modules samba ghcr.io/nethserver/samba:mail_notify
redis-cli hset cluster/override/modules openldap ghcr.io/nethserver/openldap:mail_notify

Then, install:

  • an internal OpenLDAP
  • an internal Active Directory

Usage example

  1. Configure SMTP settings
  2. Configure a domain:
api-cli run cluster/set-user-domain-notification --data '{"domain": "ad.leader.cluster0.gs.nethserver.net", "notification": true, "days": 1000, "mail_template": "default_en", "mail_from": "[email protected]", "mail_subject": "My password notification"}'
  1. Create a user,
  2. Modify the user by adding a mail address.
    For Samba:
runagent -m samba1
echo '{"user":"giacomo","mail":"[email protected]"}' | ../api-moduled/handlers/alter-user/post

For OpenLDAP:

runagent -m openldap1
echo '{"user":"giacomo","mail":"[email protected]"}' | ../api-moduled/handlers/alter-user/post
  1. Execute the notify script:
systemctl start user-domain-notification.service

Custom template

  1. Create a file custom.txt
  2. Upload it:
api-cli run cluster/upload-user-domain-notification-template --data '{"name": "custom_text", "content": "'$(cat custom.txt| base64 -w 0)'"}'
  1. Use it:
api-cli run cluster/set-user-domain-notification --data '{"domain": "ad.leader.cluster0.gs.nethserver.net", "notification": true, "days": 1000, "mail_template": "custom_text", "mail_from": "[email protected]", "mail_subject": "My password notification"}

See also:

github-actions bot pushed a commit that referenced this pull request Mar 6, 2025
@gsanchietti gsanchietti self-assigned this Mar 6, 2025
github-actions bot pushed a commit that referenced this pull request Mar 6, 2025
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
New info can be used to expose password expiration
on the UI and also to send notification about password expiration
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
New info can be used to expose password expiration
on the UI and also to send notification about password expiration
Configure mail notification for a given user domain
The API can be used to upload a custom notification template
github-actions bot pushed a commit that referenced this pull request Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant